package com.jomoo.css.common.core.service;

import java.io.Serializable;
import java.util.Collection;

public interface IEntityCommandBase {
    /**
     * 根据主键获取
     *
     * @param domainClass
     * @param id
     * @return
     */
	public<X, ID extends Serializable> X get(Class<X> domainClass, ID id);

    /**
     * @param entity
     */
    void save(Object entity);

    /**
     * @param entities
     */
    void saveAll(Collection entities);

    void remove(Object entity);
    void removeById(Class clazz, Serializable id);
    void removeByIds(Class clazz, Collection<Serializable> ids);
    /**
     * @param entities
     */
    void removeAll(Collection entities);

    public void update(Object entity);

    public void update(Object entity, Boolean isSaveNull);

    /**
     * @param entities
     */
    void updateAll(Collection entities);

    void updateAll(Collection entities, Boolean isSaveNull);

    Object findById(Class clazz, Serializable id);

    /**
     * @param entity
     */
    void saveOrUpdate(Object entity);

    /**
     * @param entities
     */
    void saveOrUpdateAll(Collection entities);
}
